package com.example.statistics.ui.purchase

import com.example.statistics.R
import com.example.statistics.bean.PurchaseAgentBean
import com.example.statistics.common.BaseLoadingListActivity
import com.example.statistics.net.UrlConfig
import com.example.statistics.utils.Constants
import com.jhj.slimadapter.SlimAdapter
import com.jhj.slimadapter.holder.ViewInjector
import org.jetbrains.anko.startActivity

class PurchaseAgentListActivity : BaseLoadingListActivity<PurchaseAgentBean>() {

    override val title: String
        get() = "采购"

    override val url: String
        get() = UrlConfig.PURCHASE_AGENT_LIST

    override val itemLayoutRes: Int
        get() = R.layout.list_item_common_display

    override fun itemViewConvert(adapter: SlimAdapter, injector: ViewInjector, bean: PurchaseAgentBean, position: Int) {
        val text = "库存:${bean.stockNumber} | " +
                "拆柜:${bean.divideNumber} | " +
                "运输:${bean.transportNumber} | " +
                "出库:${bean.salesNumber}"
        injector.text(R.id.tv_title, bean.agent)
            .text(R.id.tv_subtitle, text)
            .clicked {
                startActivity<PurchaseProductListActivity>(Constants.DATA to bean)
            }
    }


}